home *** CD-ROM | disk | FTP | other *** search
/ CDUTIL 13 / CDUTIL #13 Julio 1995.iso / windows / acadcom / acrx / inc / adesk.h next >
Encoding:
C/C++ Source or Header  |  1995-02-08  |  4.4 KB  |  139 lines

  1. #ifndef AD_ADESK_H
  2. #define AD_ADESK_H
  3. //
  4. //
  5. /*
  6.    Copyright (C) 1993, 1994 by Autodesk, Inc.
  7.  
  8.    Permission to use, copy, modify, and distribute this software in 
  9.    object code form for any purpose and without fee is hereby granted, 
  10.    provided that the above copyright notice appears in all copies and 
  11.    that both that copyright notice and the limited warranty and 
  12.    restricted rights notice below appear in all supporting 
  13.    documentation.
  14.  
  15.    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  
  16.    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 
  17.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  18.    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 
  19.    UNINTERRUPTED OR ERROR FREE.
  20.  
  21.    Use, duplication, or disclosure by the U.S. Government is subject to 
  22.    restrictions set forth in FAR 52.227-19 (Commercial Computer 
  23.    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 
  24.    (Rights in Technical Data and Computer Software), as applicable.
  25.     
  26.    .
  27. */
  28. // CREATED BY: James Rowell, summer 1993 (R13)
  29. //
  30. // DESCRIPTION:
  31. //
  32. // This file contains the extension to the standard set of primitive-
  33. // type names that should be shared by all Autodesk developers, both
  34. // in-house and third-party.  All new code and modules written in C++
  35. // should use these type names along with those supplied by C++ itself
  36. // (for example, int, long, float, double, etc.)
  37. //
  38. // See adeskabb.h for abbreviations of the following names.
  39.  
  40. #include <limits.h>
  41.  
  42. struct Adesk
  43. {
  44.     // The types Int8, Int16 and Int32 will be conditionally compiled
  45.     // to guarantee that each one represents an integer type of exactly
  46.     // 8, 16 and 32 bits respectively.    These are to be used only when
  47.     // the EXACT size of the integer is critical.
  48.     //
  49.     typedef char       Int8;
  50.     typedef short       Int16;
  51.     typedef long       Int32;
  52.     //
  53.     // The unsigned versions of the above types.
  54.     //
  55.     typedef unsigned char  UInt8;
  56.     typedef unsigned short UInt16;
  57.     typedef unsigned long  UInt32;
  58.  
  59.     //    Size limits on above types, from limits.h.  The size limits
  60.     //  on long types don't necessarily fit in an enum, so they are
  61.     //  omitted.  Even kUInt16Max is suspect, but we'll wait until
  62.     //    some compiler complains.
  63.     //
  64.     enum    {    kInt8Min    = CHAR_MIN,
  65.         kInt8Max    = CHAR_MAX,
  66.         kInt16Min   = SHRT_MIN,
  67.         kInt16Max   = SHRT_MAX,
  68.         //    kInt32Min   = LONG_MIN,
  69.         //    kInt32Max   = LONG_MAX,
  70.  
  71.         kUInt8Max   = UCHAR_MAX,
  72.         kUInt16Max  = USHRT_MAX
  73.         //    kUInt32Max  = ULONG_MAX
  74.         };
  75.  
  76.     // TEMPORARY.  DO NOT USE!  USE "double", this will disappear.
  77.     //
  78.     typedef double       Real;
  79.  
  80.     // Convenient abbreviations (use optionally).
  81.     //
  82.     typedef unsigned char  uchar;
  83.     typedef unsigned short ushort;
  84.     typedef unsigned int   uint;
  85.     typedef unsigned long  ulong;
  86.  
  87.     // Logical type (Note: never use int when Boolean is intended!)
  88.     //
  89.     typedef int        Boolean;
  90.     enum           { kFalse = 0, kTrue = 1 };
  91.  
  92.     // Error handling.
  93.     //
  94.     typedef int            ErrorCode;
  95.     enum                   { eGood = 0, eBad, eInsufficientMemory,
  96.                  eLast = eGood + 99 };
  97. };
  98.  
  99. #ifndef NULL
  100. #define NULL 0
  101. #endif
  102.  
  103. // How to use ErrorCode.
  104. //
  105. // This is the basis for the default error handling mechanism.
  106. // It is a simple enumeration which can be extended in any class
  107. // without collision with this "global" list of error codes, or any
  108. // list of error codes in one of its base classes.
  109. //
  110. // For example, a class has to define some new error codes:
  111. //
  112. // class Foo
  113. // {
  114. // public:
  115. //     enum {
  116. //       eTooManyFoos = Adesk::eLast + 1,
  117. //       eFooBarfed,
  118. //       eCannotFooToday,
  119. //       eLast = eTooManyFoos + 99
  120. //     };
  121. // };
  122. //
  123. // Since Foo is a base class, then the first error in in its
  124. // list must be one larger than the last element in the global
  125. // list.  Up to 99 new items can actually be added to the 
  126. // global list without causing the value of eFooError1 to change.
  127. // Similarly new items can be added to the error codes in the Foo
  128. // class without causing a "ripple effect" of changed values in any
  129. // of its derived classes.
  130. //
  131. // In the way that Foo used Adesk::eLast to define its first value,
  132. // any derived classes of Foo will do the same thing using the
  133. // value Foo::eLast + 1.
  134. //
  135. // Autodesk software will write and read Adesk::ErrorCode as a
  136. // short integer.
  137.  
  138. #endif
  139.